package cn.gson.crm.controller;

import java.util.List;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.gson.crm.model.dao.ApplyDao;
import cn.gson.crm.model.dao.CustomerDao;
import cn.gson.crm.model.entity.Apply;
import cn.gson.crm.model.entity.Employee;
import cn.gson.crm.vo.CustomerVo;

/**
 * 管理界面
 */
@WebServlet("/manager")
public class ManagerServlet extends BaseServlet {
	private static final long serialVersionUID = 1L;
   
    public ManagerServlet() {
        super();
    }

	protected void get(HttpServletRequest request, HttpServletResponse response) throws Exception {
		Employee e = (Employee) request.getSession().getAttribute("emp");
		List<CustomerVo> listCust = new CustomerDao().getAllCustomer(e.getEmpId(),1);
		List<Apply> listApply = new ApplyDao().getAllNeedApplyByEmpId(e.getEmpId());
		request.getSession().setAttribute("listApply", listApply);
		request.getSession().setAttribute("listCust", listCust.size());
		forward("manager.jsp");
	}

}
